import request from '@/utils/request'
import { SigninInfoType, SigninResType, SigninReqType } from './auth.type'

export function getSigninInfo() {
  return request<SigninInfoType>({
    url: '/login/info',
    method: 'get',
  })
}

export function getCaptchaImg() {
  return request<Blob>({
    url: `/captcha_pro`,
    method: 'get',
    responseType: 'blob',
    params: { t: Date.now() },
  })
}

export function signin(data: SigninReqType) {
  return request<SigninResType>({
    url: '/login',
    method: 'post',
    data,
  })
}

export function signout() {
  return request<void>({
    url: '/setting/admin/logout',
    method: 'get',
  })
}